package com.artPreter.controller;



import com.artPreter.pojo.ContentTag;
import com.artPreter.pojo.Result;

import com.artPreter.service.IContentTagService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 模块标签表 前端控制器
 * </p>
 *
 * @author jarvis
 * @since 2024-11-26
 */
@RestController
@RequestMapping("/contentTag")
public class ContentTagController {


    @Autowired
    private IContentTagService contentTagService;

    /**
     * 板块分类分页
     * @param currentPage
     * @param size
     * @param
     * @return
     */
    @PostMapping("/getPage")
    public Result getPage(@RequestParam(value = "currentPage",defaultValue = "1") Integer currentPage, @RequestParam(value = "size",defaultValue = "10") Integer size, @RequestBody ContentTag contentTag) {
        IPage<ContentTag> contentTagIPage = contentTagService.getPage(currentPage, size, contentTag);
        return Result.success(contentTagIPage);
    }

    /**
     *  添加板块分类
     * @param contentTag
     * @return
     */
    @PostMapping("/add")
    public Result add(@RequestBody ContentTag contentTag) {
        contentTagService.add(contentTag);
        return Result.success();
    }

    /**
     *  修改板块分类
     * @param
     * @return
     */
    @PostMapping("/edit")
    public Result edit(@RequestBody ContentTag contentTag) {
        contentTagService.edit(contentTag);
        return Result.success();
    }

    /**
     * 删除板块分类
     * @param
     * @return
     */
    @PostMapping("/delete")
    public Result delete(@RequestBody ContentTag contentTag){
        contentTagService.delete(contentTag);
        return Result.success();
    }

    /**
     * 获取板块分类列表
     * @param
     * @return
     */
    @PostMapping("/getList")
    public Result getList(@RequestBody ContentTag contentTag){
        List<ContentTag> result = contentTagService.getList(contentTag);
        return Result.success(result);
    }

}
